package com.mnf.server.component;

import java.io.IOException;
import java.util.Date;

import javax.servlet.http.HttpServletResponse;

import org.eclipse.jetty.server.Handler;

public class MusicHttpServer extends AbstractHttpServer {
	
	public MusicHttpServer(String ipAddress, int port) {
		super(ipAddress, port);
	}

	@Override
	protected Handler createHandler() {
		return new AbstractMusicHttpServerHandler() {

			@Override
			protected void onPlayRequestCommand(boolean play,
					HttpServletResponse httpResponse) throws IOException {
				onPlay(play);
				handlePlayResponse(play, httpResponse);
			}

			@Override
			protected void onStopRequestCommand(boolean stop,
					HttpServletResponse httpResponse) {
				onStop(stop);
			}

			@Override
			protected void onGotoTimeRequestCommand(Date time,
					HttpServletResponse httpResponse) {
				onGotoTime(time);
			}

			@Override
			protected void onVolumeTimeRequestCommand(int volume,
					HttpServletResponse httpResponse) {
				onVolumeTo(volume);
			}};
	}
	
	protected void handlePlayResponse(boolean play,
			HttpServletResponse httpResponse) throws IOException {		
	}

	protected void onPlay(boolean play) {		
	}
	
	protected void onStop(boolean stop) {		
	}
	
	protected void onGotoTime(Date time) {		
	}
	
	protected void onVolumeTo(int volume) {		
	}	

}
